package rules.tree;

import org.jdom.Element;

public class Function {

	private Element el;
        private String name;
        private Var v; 
        private String constante;
        private Function f;

	public Function(Element el) {
            this.el = el;
	}

        public Function(String name, Var v){
            el = new Element("function");
            Element args = new Element("args");
            el.addContent(args);
            el.setAttribute("name", name);
            args.addContent(v.getElement());
            this.v = v;
        }

        public Function(String name, String c){
            el = new Element("function");
            Element args = new Element("args");
            el.addContent(args);
            el.setAttribute("name", name);
            Element constant = new Element("constant");
            constant.setText(c);
            this.constante = c;
        }

        public Function(String name, Function f){
            el = new Element("function");
            Element args = new Element("args");
            el.addContent(args);
            el.setAttribute("name", name);
            args.addContent(f.getElement());
            this.f = f;
        }
	
	public String print(){
            return el.getAttributeValue("name");
	}

        public Element getElement(){
            return el;
        }
        
}
